home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
jpi
/
warbot.frm
< prev
next >
Wrap
Text File
|
1998-01-09
|
3KB
|
128 lines
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "Form1"
ClientHeight = 1455
ClientLeft = 3540
ClientTop = 1515
ClientWidth = 3615
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1455
ScaleWidth = 3615
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command2
Caption = "Disconnect"
Height = 375
Left = 2400
TabIndex = 5
Top = 960
Width = 1095
End
Begin MSWinsockLib.Winsock Winsock1
Left = 1440
Top = 840
_ExtentX = 741
_ExtentY = 741
End
Begin VB.CommandButton Command1
Caption = "Go"
Height = 375
Left = 120
TabIndex = 4
Top = 960
Width = 1095
End
Begin VB.TextBox Text2
Height = 285
Left = 600
TabIndex = 2
Text = "4000"
Top = 480
Width = 2895
End
Begin VB.TextBox Text1
Height = 285
Left = 600
TabIndex = 0
Top = 120
Width = 2895
End
Begin VB.Label Label2
Caption = "Port"
Height = 255
Left = 120
TabIndex = 3
Top = 480
Width = 615
End
Begin VB.Label Label1
Caption = "IP"
Height = 255
Left = 120
TabIndex = 1
Top = 120
Width = 615
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private GotData As String
Private ConnectedToServer As Boolean
Private Sub Command1_Click()
Winsock1.RemoteHost = Text1.Text
Winsock1.RemotePort = Val(Text2.Text)
Winsock1.Connect
Do
DoEvents
If ConnectedToServer = True Then Exit Do
Loop
Call waitforincomingdata
Call SendData(1001, "WarBot")
Call waitforincomingdata
Do
Starttime = Timer + 4
Do
If Timer > Starttime Then Exit Do
DoEvents
Loop
Call SendData(1009, "00010001000500050005000000050000|")
Loop
End Sub
Sub SendData(DataCode, DataString)
If ConnectedToServer = True Then
Winsock1.SendData DataCode & DataString
End If
End Sub
Sub waitforincomingdata()
Do
DoEvents
If GotData <> "" Then Exit Do
Loop
End Sub
Private Sub Command2_Click()
Call SendData(1007, "Yo")
DoEvents
End
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub Winsock1_Connect()
ConnectedToServer = True
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim SData As String
On Error Resume Next
Winsock1.GetData SData, vbString
GotData = SData
End Sub